package cn.easyutil.project.demo.utils;

import cn.easyutil.project.base.util.HttpUtil;
import cn.easyutil.project.base.util.JsonUtil;
import cn.easyutil.project.base.util.StringUtil;
import cn.easyutil.project.demo.bean.UserBean;

public class TestHttp {

    public static void main(String[] args) {
        HttpUtil util = new HttpUtil("http://localhost:8080/apis/20001");
        util.setRequestMethod("POST");
        UserBean user = new UserBean();
        user.setMobile("133333333");
        user.setPassword("123456");
        user.setNickName("nick");
        util.setJsonRequestParam(user);
        String result = util.doUrl();
        System.out.println(result);
        util.setRequestUrl("http://localhost:8080/apis/s-20001")
        .setRequestParam(StringUtil.toAES(JsonUtil.beanToJson(user),"ptNadF6LoBRwGwFD"))
                .setHeaders("Content-Type","application/json")
        .doUrl();
    }
}
